#ifndef DIRECTORY
#define DIRECTORY
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>   
#include <string.h>  
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
int create_directory(const char *path, mode_t mode);
int remove_directory(const char *path);
int create_directory_recursive(const char *path, mode_t mode); // 递归创建多层目录
int remove_directory_recursive(const char *path);             // 递归删除目录及其内容

#define CREATE_DIR_CHECK(ret,path)\
    do{\
        if((ret) == -1){\
            fprintf(stderr,"创建目录失败%s: %s\n",(path),strerror(errno));\
            return -1;\
        }\
    }while(0)

#define REMOVE_DIR_CHECK(ret, path)\
    do{\
        if((ret) == -1){\
            fprintf(stderr,"删除目录失败%s; %s\n", (path),strerror(errno));\
            return -1;\
        }\
    }while(0)
#endif
